package com.yzy.exception;

import com.yzy.util.response.ResponseUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionHandle {

    @ExceptionHandler({VisionException.class})
    public ResponseEntity<?> handlerVisionException(VisionException e) {
        return com.yzy.util.response.ResponseUtils.ERROR(e);
    }

    @ExceptionHandler({Exception.class})
    public ResponseEntity<?> handlerException(Exception e) {
        return ResponseUtils.ERROR(HttpStatus.INTERNAL_SERVER_ERROR, e);
    }
}
